#override("title")
SpringWind - 场地列表
#end
#override("css")
<link href="#springUrl('/static/css/plugins/bootstrap-table/bootstrap-table.min.css')" rel="stylesheet">
<link href="#springUrl('/static/css/less/style.css')" rel="stylesheet">
<style type="text/css">
	.d1{
		padding-right: 50%;
	}
	.d2{
		padding-right: 20%;
	}
	.black_overlay{
		display: none;
		position: absolute;
		top: 0%;
		left: 0%;
		width: 100%;
		height: 100%;
		background-color: black;
		z-index:1001;
		-moz-opacity: 0.8;
		opacity:.80;
		filter: alpha(opacity=88);
	}
	.white_content {
		display: none;
		position: absolute;
		top: 25%;
		left: 25%;
		width: 65%;
		height: 20%;
		padding: 0%;
		background-color: white;
		z-index:1002;
		overflow: auto;
	}
	.threatTop{
		top: 0%;
		left: 0%;
		padding: 0;
		margin: 0;
		width: 100%;
		height: 8%;
		background-color: #F8F8F8;
	}
	.tableThreat{
		table-layout:fixed;
		empty-cells:show;
		border-collapse: collapse;
		margin:0 auto;
		border:1px solid #cad9ea;
		color:#666;
	}
	.tableThreat th {
		font: bold 12px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
		color: #4f6b72;
		border-right: 1px solid #C1DAD7;
		border-bottom: 1px solid #C1DAD7;
		border-top: 1px solid #C1DAD7;
		letter-spacing: 2px;
		text-transform: uppercase;
		text-align: left;
		padding: 6px 6px 6px 12px;
		background: #CAE8EA no-repeat;
	}
	.tableThreat td,.table th{
		border-right: 1px solid #C1DAD7;
		border-bottom: 1px solid #C1DAD7;
		background: #fff;
		font-size:14px;
		padding: 6px 6px 6px 12px;
		color: #4f6b72;
	}
	.tableThreat tr.alter{
		background-color:#f5fafe;
	}
</style>
#end
#override("breadcrumb")
<li><a>评分系统</a></li><li class="active"><strong>场地列表</strong><strong>$!{province}</strong><strong>$!{city}</strong></li>



<div class="container">
	<ul class="nav nav-pills nav-justified step step-arrow">
		<li>
			<a href="#springUrl('/examine/source')/${siteId}/0">污染物</a>
		</li>
		<li>
			<a href="#springUrl('/examine/ground')/${siteId}/0">地下水</a>
		</li>
		<li>
			<a href="#springUrl('/examine/surfaceIndex')/${siteId}/0/0/0">地表水</a>
		</li>
		<li>
			<a href="#springUrl('/examine/soil')/${siteId}">土壤</a>
		</li>
		<li>
			<a href="#springUrl('/examine/air')/${siteId}">空气</a>
		</li>
	</ul>
</div>


#end
#override("content")
<div class="ibox-content" style="margin:3%;padding: 5% 10%">
	<form id="myForm" class="form-horizontal" autocomplete="off" data-validator-option="{theme:'default'}">

		<input id="gid" type="hidden" name="id" value="$!{groundWater.id}">

		<div class="form-group" style="padding-top: 3%"><label class="col-sm-2 control-label" style="margin: 0 auto">地下水名称:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control"  name="aquifer_name" id="aquifer_name"  value="$!{groundWater.aquifer_name}" placeholder="请输入地下水名称" data-rule="地下水名称:required;aquifer_name" readonly>
			</div>
		</div>

		<div class="form-group" style="padding-top: 3%">
			<label class="col-sm-2 control-label" style="margin: 0 auto">仅评估该地下水层的得分:</label>
			<input type="checkbox" class=""  name="isCalculate" id="isCalculate"  value="1" style="width: 20px;height: 20px">
		</div>
		<div class="form-group" style="padding-top: 3%">
			<label class="col-sm-2 control-label" style="margin: 0 auto">是否为喀斯特地貌:</label>
			<input type="checkbox" class=""  name="is_karst" id="is_karst"  value="1" style="width: 20px;height: 20px">
		</div>

		<div class="hr-line-dashed"></div>
		<div class="form-group"><label class=" control-label" style="margin: 0 auto;">污染物释放可能性因子值:</label>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label" >1.污染物释放可能性因子值:</label>
			<div class="col-sm-10 d2">
				<!--<input type="hidden" class="form-control" name="ObsRelease" >-->
				<select name="observed_release" class="form-control"  id="observed_release"style="width: 50%">
					<option value="0">0</option>
					<option value="550">550(污染物已经进入地下水含水层)</option>
				</select>
			</div>
		</div>
		<div class="hr-line-dashed"></div>

		<div class="form-group"><label class=" control-label">2.污染物潜在释放可能性因子值:</label>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">2a.污染源围堵因子值:<a onclick="surface(this.name)" name="3-2">(3-2)</a></label>
			<div class="col-sm-10 d2">
				<select name="containment" class="form-control"  id="containment"style="width: 50%">
					<option>0</option>
					<option>3</option>
					<option>5</option>
					<option>7</option>
					<option>9</option>
					<option>10</option>
				</select>
			</div>
		</div>

		<div class="form-group"><label class="col-sm-2 control-label">2b.地下水途径降雨因子值:<a onclick="surface(this.name)" name="3-4">(3-4)</a></label>
			<div class="col-sm-10 d2">
				<select name="net_precip" class="form-control"  id="net_precip"style="width: 50%">
					<option>0</option>
					<option>1</option>
					<option>3</option>
					<option>6</option>
					<option>10</option>
				</select>
			</div>
		</div>

		<div class="form-group"><label class="col-sm-2 control-label">2c.含水层深度因子值:<a onclick="surface(this.name)" name="3-5">(3-5)</a></label>
			<div class="col-sm-10 d2">
				<select name="depth_to_auuifer" class="form-control"  id="depth_to_auuifer"style="width: 50%">
					<option>1</option>
					<option>3</option>
					<option>5</option>
				</select>
			</div>
		</div>

		<div class="form-group"><label class="col-sm-2 control-label">2d.运移时间因子值:<a onclick="surface(this.name)" name="3-6">(3-6)</a></label>
			<div class="col-sm-10 d2">
				<select name="travel_time" class="form-control"  id="travel_time"style="width: 50%">
					<option>1</option>
					<option>5</option>
					<option>15</option>
					<option>25</option>
					<option>35</option>
				</select>
			</div>
		</div>

		<div class="form-group"><label class="col-sm-2 control-label">2e.污染物潜在释放可能性因子值:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control" id="potential_to_release" name="potential_to_release"  value="#if ( $groundWater ) $!{groundWater.potential_to_release}  #else  0  #end" readonly>
			</div>
		</div>

		<div class="form-group"><label class="col-sm-2 control-label">3.污染物释放可能性因子值:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control" id="likelihood_of_release" name="likelihood_of_release"  value="#if ( $groundWater ) $!{groundWater.likelihood_of_release}  #else  0  #end" readonly>
			</div>
		</div>
		<div class="hr-line-dashed"></div>
		<div class="form-group"><label class="col-sm-2 control-label" >废物特征:</label>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">4.毒性:
			<button class="btn btn-info" onclick="openThreat('dwThreatG','dwFadeG');return false">移动性</button>
		</label>



			<div id="dwThreatG" class="white_content">
				<div class="threatTop">
					<a href = "javascript:void(0)" onclick = "closeThreat('dwThreatG','dwFadeG')" >
						<p style="font-size: 30px;margin-left:95%;display: inline">×</p></a>
				</div>
				<div class="col-sm-10 d2" style="width: 100%;margin-top: 5%">
					<div style="display: inline;float: left;width: 50%;margin-left: 7%">
						<label class=" control-label" style="margin: 0 auto">选择主要元素:</label><br>
						<select id="threat1G" multiple="multiple" size="6"  class="form-control"style="height: 10%;display: inline">
						</select>
						<!--<button onclick = "closeThreat('dwThreatG','dwFadeG');maxPersistenceCaculate('PerToxG','substance','persistence','hasWasteQuantity','waste_characteristics');return false" class="btn btn-info">
							保存并返回</button>-->
					</div>
					<div style="display: inline;float: right">

						<label class=" control-label" style="margin: 0 auto">选择流动方式:</label><br>
						<input type="radio" name="mob_type" value="MOBLK" id="MOBLKG" onclick=changeThreat('threat1G','mobType','MOBLK')><label style="font-size: 15px;margin-left: 3px">液体/喀斯特</label><br>
						<input type="radio" name="mob_type" value="MOBLNK" id="MOBLNKG" onclick=changeThreat('threat1G','mobType','MOBLNK')><label style="font-size: 15px;margin-left: 3px">液体/非喀斯特</label><br>
						<input type="radio" name="mob_type" value="MOBNLK" id="MOBNLKG" onclick=changeThreat('threat1G','mobType','MOBNLK')><label style="font-size: 15px;margin-left: 3px">非液体/喀斯特</label><br>
						<input type="radio" name="mob_type" value="MOBNLNK" id="MOBNLNKG" onclick=changeThreat('threat1G','mobType','MOBNLNK')><label style="font-size: 15px;margin-left: 3px">非液体/非喀斯特</label><br>
						<input type="radio" name="mob_type" value="InOR" id="InORG" onclick=changeThreat('threat1G','mobType','InOR')><label style="font-size: 15px;margin-left: 3px">处于可观察范围</label><br>

					</div>
				</div>
				<div style="padding-top: 30%;">
					<table width="90%" class="tableThreat" id="tableThreatG">

					</table>
				</div>
			</div>
			<div id="dwFadeG" class="black_overlay"></div>




			<div class="col-sm-10 d1">
				<input type="text" class="form-control" name="persistence" id="persistence" value="0" readonly>
			</div>
		</div>

		<div class="form-group"><label class="col-sm-2 control-label">使用物质:</label>
			<div class="col-sm-10 d2">
				<!--<input type="hidden" class="form-control" name="substance"  >-->
				<select name="substance" id="substance" class="form-control"style="width: 50%">
					<!--<option>Aldrin</option>
					<option>Benzidine</option>-->
				</select>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">5.有害废物量:<a onclick="surface(this.name)" name="2-6">(2-6)</a></label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control" name="hasWasteQuantity" id="hasWasteQuantity"  value="10" readonly>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">6.废物特征:<a onclick="surface(this.name)" name="2-7">(2-7)</a></label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control" id="waste_characteristics" name="waste_characteristics"   readonly>
			</div>
		</div>
		<div class="hr-line-dashed"></div>
		<div class="form-group"><label class="col-sm-2 control-label" >目标因子值:</label>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">7.最近水井目标因子值:<a onclick="surface(this.name)" name="3-11">(3-11)</a></label>
			<div class="col-sm-10 d2">
				<!--<input type="hidden" class="form-control" name="nearest_intake"  >-->
				<select name="near_well" id="near_well" class="form-control"style="width: 50%">
					<option>0</option>
					<option>2</option>
					<option>3</option>
					<option>5</option>
					<option>9</option>
					<option>18</option>
					<option>20</option>
					<option>45</option>
					<option>50</option>
				</select>
			</div>
		</div>


		<div class="form-group"><label class="col-sm-2 control-label" >8.人口目标因子值:</label>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">8a.暴露于水平1浓度的人口数量：</label>
			<div class="col-sm-10 d1">
				<input type="text"  class="form-control" id="pop_concent1" name="pop_concent1"  placeholder="请输入该目标因子值"  value="$!{groundWater.pop_concent1}" data-rule="人口目标因子值1:required;pop_concent1" readonly>
				<div class="alert alert-warning alert-dismissible" role="alert" style="display: none" id="8aErrMsg">
					<!--data-dismiss="alert" aria-label="Close"-->
					<button type="button" class="close"  id="8aMsg" onclick="closeErr(this.id);return false"><span aria-hidden="true">&times;</span></button>
					<strong>错误!</strong> 请输入正确数值！
				</div>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">8b.暴露于水平2浓度的人口数量：</label>
			<div class="col-sm-10 d1">
				<input type="text"  class="form-control" id="pop_concent2" name="pop_concent2"  placeholder="请输入该目标因子值"  value="$!{groundWater.pop_concent2}" data-rule="人口目标因子值2:required;pop_concent2" readonly>
				<div class="alert alert-warning alert-dismissible" role="alert" style="display: none" id="8bErrMsg">
					<!--data-dismiss="alert" aria-label="Close"-->
					<button type="button" class="close"  id="8bMsg" onclick="closeErr(this.id);return false"><span aria-hidden="true">&times;</span></button>
					<strong>错误!</strong> 请输入正确数值！
				</div>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">8c.暴露于潜在污染的标准人口数量：<a onclick="surface(this.name)" name="3-12">(3-12)</a></label>
			<div class="col-sm-10 d1">
				<input type="text"  class="form-control" id="pot_concent" name="pot_concent"  placeholder="请输入该目标因子值"  value="$!{groundWater.pot_concent}" data-rule="潜在人口目标因子值:required;pot_concent" readonly>
				<div class="alert alert-warning alert-dismissible" role="alert" style="display: none" id="8cErrMsg">
					<!--data-dismiss="alert" aria-label="Close"-->
					<button type="button" class="close"  id="8cMsg" onclick="closeErr(this.id);return false"><span aria-hidden="true">&times;</span></button>
					<strong>错误!</strong> 请输入正确数值！
				</div>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">8d.人口目标因子值:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control" id="population" name="population"  value="#if ( $groundWater ) $!{groundWater.population}  #else  0  #end" readonly>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">9.资源目标因子值:</label>
			<div class="col-sm-10 d2">
				<!--<input type="hidden" class="form-control" name="resource"  >-->
				<select name="resource" id="resource" class="form-control"style="width: 50%">
					<option>0</option>
					<option>5</option>
				</select>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">10.井头保护区因子值:</label>
			<div class="col-sm-10 d2">
				<!--<input type="hidden" class="form-control" name="resource"  >-->
				<select name="well_pro_area" id="well_pro_area" class="form-control"style="width: 50%">
					<option>0</option>
					<option>5</option>
					<option>20</option>
				</select>
			</div>
		</div>

		<div class="form-group"><label class="col-sm-2 control-label">11.目标因子值:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control" id="target" name="target"  value="#if ( $groundWater ) $!{groundWater.target}  #else  0  #end" readonly>
			</div>
		</div>
		<div class="hr-line-dashed"></div>



		<div class="form-group"><label class=" control-label" >地下水暴露途径评分:</label>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label">12.地下水暴露途径评分:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control" id="aquifer_source" name="aquifer_source"  value="$!{groundWater.aquifer_source}" readonly>
			</div>
		</div>
		<div class="form-group"><label class="col-sm-2 control-label" >未经扫描得分:</label>
			<div class="col-sm-10 d1">
				<input type="text" class="form-control" id="uncapped_score" name="uncapped_score"  value="$!{groundWater.uncapped_score}" readonly>
			</div>
		</div>
		<div class="hr-line-dashed"></div>
		<div class="form-group">
			<div class="text-center">
				<a class="btn btn-primary btn-next" href="#springUrl('/examine/source/')${siteId}/0" >  <  </a>
				<!--<button class="btn btn-primary" type="submit">保 存</button>-->
				<a class="btn btn-primary btn-next" href="#springUrl('/examine/surfaceIndex/')${siteId}/0/0/0" >  >  </a>
			</div>
		</div>
	</form>

	<div class="row ibox-content" style="margin:3%;padding: 4% 2%">
		<div id="tabContainer"></div>
		<div class="row">
			<div class="col-sm-12">
				<table width="100%" class="tableThreat" id="tableIndex">
				</table>
			</div>
		</div>
	</div>


</div>

#end
#override("js")
<!--<script src="#springUrl('/static/js/base_list.js')"></script>
<script src="#springUrl('/static/js/common.js')"></script>
<script src="#springUrl('/static/js/jquery-2.1.1.js')"></script>
<script src="#springUrl('/static/plugins/layer-v2.2/layer/layer.js')"></script>
<script src="#springUrl('/static/plugins/nice-validator-0.8.1/jquery.validator.js?local=zh-CN')"></script>
<script src="#springUrl('/static/js/lib/less.js')"></script>
<script src="#springUrl('/static/js/lib/jquery.min.js')"></script>
<script src="#springUrl('/static/js/lib/lib.js')"></script>-->
<script src="#springUrl('/static/js/plugins/bootstrap-table/bootstrap-table.min.js')"></script>
<script src="#springUrl('/static/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js')"></script>
<script src="#springUrl('/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js')"></script>
<script src="#springUrl('/static/js/common.js')"></script>
<script src="#springUrl('/static/plugins/layer-v2.2/layer/layer.js')"></script>
<script src="#springUrl('/static/js/lib/less.js')"></script>
<script src="#springUrl('/static/js/lib/jquery.min.js')"></script>
<script src="#springUrl('/static/js/lib/lib.js')"></script>
<script src="#springUrl('/static/plugins/nice-validator-0.8.1/jquery.validator.js?local=zh-CN')"></script>
<script type="text/javascript">

/*
    $("#myForm").validator({
        valid: function(form){
            var me = this;
            // 提交表单之前，hold住表单，防止重复提交
            me.holdSubmit();

            for(t = 0;t<sdList.length;t++){
                sdList[t].select_type = JSON.stringify(type[t]).replace(/\"/g,'\\"');
            }

            /!*  $.post("#springUrl('/groundWater/caculateScore')",$.param({'sdList':JSON.stringify(sdList)})+'&'+$(form).serialize(),function (data) {
                  window.parent.location.reload();
              },'json');*!/


            $.ajax({
                url: "#springUrl('/groundWater/caculateScore/"+siteId+"')",
                data: $.param({'sdList':JSON.stringify(sdList)})+'&'+$(form).serialize(),
                type: "POST",
                success: function(data){
                    parent.layer.alert("保存成功",function(){
                        parent.layer.closeAll();
                        window.parent.location.reload();
                    });
                }
            });
        }
    });
*/
    var gid = '${gid}';
    var siteId = '${siteId}';
    var gList = JSON.parse('${gList}');
    var isCalculate = $('#isCalculate');
    var is_karst = $('#is_karst');
    var observed_release = $('#observed_release');
    var containment = $('#containment');
    var net_precip = $('#net_precip');
    var depth_to_auuifer = $('#depth_to_auuifer');
    var travel_time = $('#travel_time');
    var potential_to_release = $('#potential_to_release');
    var likelihood_of_release = $('#likelihood_of_release');
    var near_well = $('#near_well');
    var pop_concent1 = $('#pop_concent1');
    var pop_concent2 = $('#pop_concent2');
    var pot_concent = $('#pot_concent');
    var population = $('#population');
    var resource = $('#resource');
    var well_pro_area = $('#well_pro_area');
    var target = $('#target');
    var waste_characteristics = $('#waste_characteristics');
    var aquifer_source = $('#aquifer_source');
    var uncapped_score = $('#uncapped_score');
    var tableThreat = document.getElementById('tableThreatG');
    var sdList=JSON.parse('${sdList}');
    var type = new Array;
    for(t = 0;t<sdList.length;t++) {
        if(sdList[t].select_type!=null){
            type[t] = JSON.parse(sdList[t].select_type);
        }else{
            type[t] = new Object();
            type[t].mobType = 'MOBLK';
        }
    }
    var MOBLKG = document.getElementById('MOBLKG');
    var MOBLNKG = document.getElementById('MOBLNKG');
    var MOBNLKG = document.getElementById('MOBNLKG');
    var MOBNLNKG = document.getElementById('MOBNLNKG');
    var InORG = document.getElementById('InORG');

    $(function () {
        // alert(gid);
        bsStep(2);
        tableCreate();
        decodeMessageG();
        maxPersistenceCaculate('PerToxG','substance','persistence','hasWasteQuantity','waste_characteristics');
        if(gid != 0){
            var ic = '${groundWater.isCalculate}';
            if(ic == 1){
                isCalculate[0].checked=true;
            }
            var iw =  '${groundWater.is_karst}';
            if(iw ==1){
                is_karst[0].checked=true;
            }
            selectIn(containment,'${groundWater.containment}');
            selectIn(observed_release,'${groundWater.observed_release}');
            selectIn(net_precip,'${groundWater.net_precip}');
            selectIn(depth_to_auuifer,'${groundWater.depth_to_auuifer}');
            selectIn(travel_time,'${groundWater.travel_time}');
            selectIn(near_well,'${groundWater.near_well}');
            selectIn(resource,'${groundWater.resource}');
            selectIn(well_pro_area,'${groundWater.well_pro_area}');
            caculateLikeihood_release();
        }else {
            $('#gid').val(0);
        }

        observed_release.change(function () {
            caculateLikeihood_release();
        });
        containment.change(function () {
            caculatePotentialToRelease();
        });
        net_precip.change(function () {
            caculatePotentialToRelease();
        });
        depth_to_auuifer.change(function () {
            caculatePotentialToRelease();
        });
        travel_time.change(function () {
            caculatePotentialToRelease();
        });
        pop_concent1.change(function () {
            caculatePopulation();
        });
        pop_concent2.change(function () {
            caculatePopulation();
        });
        pot_concent.change(function () {
            caculatePopulation();
        });
        near_well.change(function () {
            caculateTarget();
        });
        resource.change(function () {
            caculateTarget();
        });
        well_pro_area.change(function () {
            caculateTarget();
        });
    });


    function caculatePotentialToRelease() {
        potential_to_release.val(containment.val()*(net_precip.val()*1+depth_to_auuifer.val()*1+travel_time.val()*1));
        caculateLikeihood_release();
    }

    function caculateLikeihood_release() {
        if(observed_release.val()==550){
            likelihood_of_release.val(550);
            caculateScore();
        }else {
            likelihood_of_release.val(potential_to_release.val());
            caculateScore();
        }
    }

    function caculatePopulation() {
        population.val(pop_concent1.val()*10+pop_concent2.val()*1+pot_concent.val()*0.1);
        caculateTarget();
    }

    function caculateTarget() {
        target.val(near_well.val()*1+population.val()*1+resource.val()*1+well_pro_area.val()*1);
        caculateScore();
    }


    function caculateScore() {
        uncapped_score.val(((likelihood_of_release.val()*waste_characteristics.val()*target.val())/82500).toFixed(2));
        if(uncapped_score.val()>100){
            aquifer_source.val(100);
        }else {
            aquifer_source.val(uncapped_score.val());
        }
    }




    function tableCreate() {
        var tdd="<tr><th>序号</th><th>名称</th><th>分数</th><th>是否计入评分</th><th>操作</th></tr>";
        for(i=0;i<gList.length;i++){
            var score = gList[i].score;
            if(score>100){
                score = 100;
            }
            var used = gList[i].used;
            var isUsed;
            if(used==true){
                isUsed = "是";
            }else {
                isUsed = "否";
            }
            tdd+="<tr><td>"+(i+1)+"</td><td>"+gList[i].name+"</td><td>"+score.toFixed(2)+"</td><td>"+isUsed+"</td>" +
                "<td><button class='btn btn-warning'  type='button' id='editSw"+i+"' onclick='editScore("+gList[i].id+");return false'>查看</button></td></tr>";
        }

        document.getElementById('tableIndex').innerHTML = tdd;
    }


    //查看功能
    function editScore(id) {
        window.parent.location.href = "#springUrl('/examine/ground/"+siteId+"/"+id+"')";
    }

    //删除功能
/*
    function delScore(id) {
        //  alert(id);

        $.ajax({
            type: 'POST',
            url: "#springUrl('/groundWater/delGroudScore/')",
            data: $.param({'id':id,'siteId':siteId}),
            success: function (result) {
                // alert(result.success);
                parent.layer.alert("删除成功",function(){
                    parent.layer.closeAll();
                    window.parent.location.reload();
                });
            },
            dataType: 'json'
        });
    }
*/


    function selectIn(key,value) {
        key.children("option").each(function(){
            var temp_value = $(this).val();
            if(temp_value == value){
                $(this).attr("selected","selected");
                key.attr('readonly','readonly');
            }
        });
    }


    function  openThreat(id,fade) {
        var light = document.getElementById(id);
        var top =  document.documentElement.scrollTop;
        light.style.display='block';
        document.getElementById(fade).style.display='block';
        // light.style.top = (document.documentElement.clientHeight-light.height)/2+top + 'px';
        // light.style.top = (window.screen.availHeight - 30 - light.style.height) / 2;
        light.style.top = top+light.style.height/2 -50 + 'px' ;
    }

    function closeThreat(id,fade) {
        var light = document.getElementById(id);
        light.style.display='none';
        var fadeD = document.getElementById(fade);
        fadeD.style.display='none';
    }


    function decodeMessageG(){
        var tmp="";
        var tdd="<tr><th>元素</th><th>毒性</th><th>流动名称</th><th>流动方式</th><th>毒性/持久性</th></tr>";
        var mob_value = 0;
        var mob_name ;
        for(i=0;i<sdList.length;i++){
            tmp+="<option onclick = getOptionG("+i+") >"+sdList[i].chnname+"</option>";

            if(type[i].mobType=="MOBLK"){
                mob_value = sdList[i].moblk;
                mob_name = '液体/喀斯特';
            }else if(type[i].mobType=="MOBLNK"){
                mob_value = sdList[i].moblnk;
                mob_name = '液体/非喀斯特';
            }else if(type[i].mobType=="MOBNLK"){
                mob_value = sdList[i].mobnlk;
                mob_name = '非液体/喀斯特';
            }else if(type[i].mobType=="MOBNLNK"){
                mob_value = sdList[i].mobnlnk;
                mob_name = '非液体/非喀斯特';
            }else if(type[i].mobType=="InOR"){
                mob_value = 1;
                mob_name = '处于可观察范围内';
            }

            tdd+="<tr><td>"+sdList[i].chnname+"</td><td id='tox"+i+"'>"+sdList[i].tox+"</td><td id='mobName"+i+"'>"+mob_name+"</td><td id='mobValue"+i+"'>"+mob_value+"</td><td id='PerToxG"+i+"'>"+(mob_value*sdList[i].tox).toFixed(3)+"</td>" +
                "<td style='display: none' id='moblk"+i+"'>"+sdList[i].moblk+"</td><td style='display: none' id='moblnk"+i+"'>"+sdList[i].moblnk+"</td><td style='display: none' id='mobnlk"+i+"'>"+sdList[i].mobnlk+"</td><td style='display: none' id='mobnlnk"+i+"'>"+sdList[i].mobnlnk+"</td></tr>";

        }

        document.getElementById("threat1G").innerHTML=tmp;
        tableThreat.innerHTML=tdd;

    }


    function getOptionG(i) {
        if (type[i].mobType=='MOBLK'){
            MOBLKG.checked='checked';
        }else if(type[i].mobType=='MOBLNK'){
            MOBLNKG.checked='checked';
        }else if(type[i].mobType=='MOBNLK'){
            MOBNLKG.checked='checked';
        }else if(type[i].mobType=='MOBNLNK'){
            MOBNLNKG.checked='checked';
        }else if(type[i].mobType=='InOR'){
            InORG.checked='checked';
        }
    }

    function changeThreat(id,key,value) {
        var myselect = document.getElementById(id);
        //获取大选择框即毒素名的选择
        var index = myselect.selectedIndex;
        var moblk = document.getElementById('moblk'+index).innerText;
        var moblnk = document.getElementById('moblnk'+index).innerText;
        var mobnlk = document.getElementById('mobnlk'+index).innerText;
        var mobnlnk = document.getElementById('mobnlnk'+index).innerText;
        var tox = document.getElementById('tox'+index).innerText;
        //赋值于type中，使之不会跳转回原来的选项
        type[index][key] = value;

        if(value=="MOBLK"){
            document.getElementById("mobValue"+index).innerHTML=moblk;
            document.getElementById("mobName"+index).innerHTML='液体/喀斯特';
            document.getElementById("PerToxG"+index).innerHTML=(tox*moblk).toFixed(3);
        }else  if(value=="MOBLNK"){
            document.getElementById("mobValue"+index).innerHTML=moblnk;
            document.getElementById("mobName"+index).innerHTML='液体/非喀斯特';
            document.getElementById("PerToxG"+index).innerHTML=(tox*moblnk).toFixed(3);
        }else  if(value=="MOBNLK"){
            document.getElementById("mobValue"+index).innerHTML=mobnlk;
            document.getElementById("mobName"+index).innerHTML='非液体/喀斯特';
            document.getElementById("PerToxG"+index).innerHTML=(tox*mobnlk).toFixed(3);
        }else  if(value=="MOBNLNK"){
            document.getElementById("mobValue"+index).innerHTML=mobnlnk;
            document.getElementById("mobName"+index).innerHTML='非液体/非喀斯特';
            document.getElementById("PerToxG"+index).innerHTML=(tox*mobnlnk).toFixed(3);
        }else  if(value=="InOR"){
            document.getElementById("mobValue"+index).innerHTML=1;
            document.getElementById("mobName"+index).innerHTML='处于可观察范围内';
            document.getElementById("PerToxG"+index).innerHTML=tox;
        }


    }


    //按保存后再获取最大值
    function maxPersistenceCaculate(tox,substance,persistence,quantity,characteristicsId) {
        var sub = document.getElementById(substance);
        var toxcity1 = new Array;
        var maxPersistence1 = 0;
        var maxPersistenceId1 = new Array;
        var maxId1=1;
        for(t = 0;t<sdList.length;t++){
            toxcity1[t] = document.getElementById(tox+t).innerText;
            //  alert(toxcity1[t]);
            if( parseFloat(toxcity1[t])>parseFloat(maxPersistence1)){
                //   alert(toxcity1[t]+">"+maxPersistence1);
                maxPersistence1= toxcity1[t];
                maxPersistenceId1.slice(0,maxPersistenceId1.length);
                maxPersistenceId1[0] =  t;
                maxId1=1;
            }else if( parseFloat(toxcity1[t])==parseFloat(maxPersistence1)){
                maxPersistenceId1[maxId1] = t;
                maxId1++;
            }
        }
        //document.getElementById(persistence).value=maxPersistence1;
        $("#"+persistence).val(maxPersistence1);
        caculateHasWasteQuantity($("#"+quantity),maxPersistence1,characteristicsId);

        var op1 = "";
        //  alert(maxPersistenceId1.length);
        for (i=0;i<maxPersistenceId1.length;i++){

            // alert(maxPersistenceId1[i]);
            op1+="<option>"+sdList[maxPersistenceId1[i]].chnname+"</option>";
        }
        sub.innerHTML = op1;
    }

    function caculateHasWasteQuantity(quantity,persistence,characteristicsId) {

        if(parseFloat(persistence)<=0){
            quantity.val(0);
        }else if(parseFloat(persistence)>0&&parseFloat(persistence)<=100){
            quantity.val(1);
        }else if(parseFloat(persistence)>100&&parseFloat(persistence)<=10000){
            quantity.val(100);
        }else if(parseFloat(persistence)>10000&&parseFloat(persistence)<=1000000){
            quantity.val(10000);
        }else if(parseFloat(persistence)>1000000){
            quantity.val(1000000);
        }
        caculateCharacteristics(quantity,persistence,characteristicsId);
    }

    function caculateCharacteristics(quantity,persistence,characteristicsId) {
        var characteristics = document.getElementById((characteristicsId));
        var t = quantity.val()*persistence;
        if(t ==0){
            waste_characteristics.val(0);
        }else if(t>0&&t<10){
            waste_characteristics.val(1);
        }else if(t>=10&&t<100){
            waste_characteristics.val(2);
        }else if(t>=100&&t<1000){
            waste_characteristics.val(3);
        }else if(t>=1000&&t<10000){
            waste_characteristics.val(6);
        }else if(t>=10000&&t<100000){
            waste_characteristics.val(10);
        }else if(t>=100000&&t<1000000){
            waste_characteristics.val(18);
        }else if(t>=1000000&&t<10000000){
            waste_characteristics.val(32);
        }else if(t>=10000000&&t<100000000){
            waste_characteristics.val(56);
        }else if(t>=100000000&&t<1000000000){
            waste_characteristics.val(100);
        }else if(t>=1000000000&&t<10000000000){
            waste_characteristics.val(180);
        }else if(t>=10000000000&&t<100000000000){
            waste_characteristics.val(320);
        }else if(t>=100000000000&&t<1000000000000){
            waste_characteristics.val(560);
        }else if(t>=1000000000000){
            waste_characteristics.val(1000);
        }
        caculateScore();
    }
    function surface(id) {
        // alert("哈哈哈");
        //	alert(id);
        var title = "表"+id;
        var url = "#springUrl('/groundWater/surface"+id+".html')";
        layer.open({
            type: 2,
            title: title,
            shadeClose: true,
            shade: 0.8,
            area: ['760px', '530px'],
            fix: false,
            maxmin: false,
            content: url
        });
    }


</script>
#end
#extends("/common/framework.html")
